package Main2;

import java.util.Scanner;
import java.util.stream.Stream;

public class Main456 {
    //把字符串转换成整数
    public int StrToInt(String str) {
        char[] chs = str.toCharArray();
        if (str == null || chs.length == 0) return 0;
        int flg = 1;
        if (chs[0] == '-') {
            flg = -1;
            chs[0] = '0';
        }
        if (chs[0] == '+') {
            flg = 1;
            chs[0] = '0';
        }
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            if (chs[i] < '0' || chs[i] > '9') return 0;
            sum = sum * 10 + chs[i] - '0';
        }
        return flg * sum;
    }
    //把字符串转换成整数 错误代码展示
    public int StrToInt1(String str) {
        if (str == null || str.isEmpty()) return 0;
        int flg = 1;
        if (str.charAt(0) == '-') flg = -1;
        if (str.charAt(0) == '+') flg = 1;
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch < '0' || ch > '9') return 0;
            sum = sum * 10 + ch - '0';
        }
        return sum;
    }
    //不要二
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt();//控制行数，就是横坐标
        int h = scan.nextInt();//控制列数，就是纵坐标
        int count = 0;
        int[][] arr = new int[w][h];
        for (int i = 0; i < w; i++) {
            for (int j = 0; j < h; j++) {
                if (arr[i][j] == 0) {
                    count++;//如果数组中的元素为0，代表可以放蛋糕
                    if (i + 2 < w) arr[i+2][j] = 1;
                    if (j + 2 < h) arr[i][j+2] = 1;
                }
            }
        }
        System.out.println(count);
    }
    //连续最大和 (连续子数组的最大和)
    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()) {
            int n = scan.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = scan.nextInt();
            }
            //数组已经录入了
            int sum = arr[0];
            int max = arr[0];
            for (int i = 1 ; i < n; i++) {
                sum = getMaxSum(sum + arr[i], arr[i]);
                if (sum >= max) max = sum;
            }
            System.out.println(max);
        }
    }

    private static int getMaxSum(int a, int b) {
        return Math.max(a, b);
    }

    //统计回文（将s2字符串插入到s1字符串不同位置中，看有多少种构成回文串的方法）
    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()) {
            String s1 = scan.nextLine();
            String s2 = scan.nextLine();
            int len = s1.length();
            int count = 0;
            for (int i = 0; i <= len; i++) {
                StringBuffer str = new StringBuffer(s1);
                str.insert(i, s2);
//                StringBuffer str5 = str.reverse();
                //这里需要定义一个tmp来new一个新的对象，否则
                //str = abc, 经过str.reverse(); --> str = cba;
                //所以此时逆置前的str5和逆置之后的字符串永远是相等的
                StringBuffer tmp = new StringBuffer(str);
                StringBuffer str5 = tmp.reverse();
                if (str5.toString().equals(str.toString())) {
                    //StringBuffer是没有equals这个方法的，需要用String的
                    count++;
                }
            }
            System.out.println(count);
        }
    }

    //进制转换
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()) {
            int m = scan.nextInt();
            int n = scan.nextInt();
            String table = "123456789ABCDEF";
            StringBuilder sb = new StringBuilder();
            boolean flg = false;
            if (m < 0) {
                m = -m;
                flg = true;
            }
            if (m == 0) {
                System.out.println(m);
            }
            while (m != 0) {
                sb.append(table.charAt(m % n));//取模是为了拿到每一个的n进制数字
                m /= n;//除以是为了去掉m每一位数字
            }
            if (flg) sb.append("-");
            sb.reverse();
            System.out.println(sb.toString());
        }
    }

    //计算糖果
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();
            int d = scan.nextInt();

            int A = (a + c) / 2;
            int B = (b + d) / 2;
            int C = (d - b) / 2;
            int B2 = (c - b) / 2;
            if (B != B2) {
                System.out.println("No");
            }else {
                System.out.println(A + " " + B + " " + C);
            }
        }
    }
}
